<template>
  <view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="topbar">
      <text v-for="(item, index) in topbar" :key="index" :class="'item ' + (currentTab == index ? 'active' : '')"
            :data-idx="index" @tap="topbarFn">{{ item }}
      </text>
    </view>
    <view class="regbox">
      <block v-if="currentTab == 0">
        <view class="listbox">
          <block v-for="(Farr, idx) in form_basic" :key="idx">
            <view v-if="Farr.subkind == 1" :class="'dl' + (idx % 6 == 0 || form_basic.length == idx + 1 ? ' dl0' : '')">
              <view class="dt">
                {{ Farr.title }}
                <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
              </view>
              <view class="dd">
                <block v-if="Farr.fieldname == 'aboutus'">
                  <view :class="'ico span' + (Farr.v == '' ? '' : ' ed')" style="width: 100%" @tap="aboutusFn">
                    {{ Farr.v == '' ? '' : Farr.v }}
                  </view>
                  <page-container
                      :closeOnSlideDown="false"
                      :overlay="true"
                      :round="true"
                      :show="if_aboutus_box"
                      customStyle="height:50%"
                      duration="300"
                      overlayStyle=""
                      position="top"
                      zIndex="222"
                      @clickoverlay="aboutusMaskFn"
                  >
                    <form :data-f="Farr.fieldname" :data-idx="idx" class="form" @submit="aboutus_submitFn">
                      <view class="aboutus_box">
                        <view class="S16 B">{{ Farr.title }}</view>
                        <textarea :focus="if_aboutus_focus" :value="Farr.v"
                                  name="aboutus" placeholder="简单介绍下自己的工作生活、三观或故事~"></textarea>
                      </view>
                      <button :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btn5" formType="submit"
                              type="button" @tap="exit">保存
                      </button>
                    </form>
                  </page-container>
                </block>
                <input
                    v-else
                    :data-f="Farr.fieldname"
                    :data-idx="idx"
                    :placeholder="'请输入' + Farr.title"
                    :style="Farr.nomod == 1 && Farr.v != '' ? 'color:#ccc' : ''"
                    :value="Farr.v == 0 || Farr.v == '' ? '' : Farr.v"
                    confirmType="完成"
                    maxlength="50"
                    type="text"
                    @blur="Ffn1_basic"
                />
              </view>
            </view>
            <picker
                v-else-if="Farr.subkind == 2 || Farr.subkind == 4"
                :class="'dl' + (idx % 6 == 0 || form_basic.length == idx + 1 ? ' dl0' : '')"
                :data-f="Farr.fieldname"
                :data-idx="idx"
                :headerText="'请选择' + Farr.title"
                :range="UDATA_var[Farr.fieldname]"
                :value="Farr.k"
                rangeKey="v"
                @change="Ffn2_basic"
            >
              <view class="dt">
                {{ Farr.title }}
                <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
              </view>
              <view class="dd">
                <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')"
                      :style="Farr.nomod == 1 && Farr.v != '' ? 'color:#ccc' : ''">
                  {{ Farr.v == 0 || Farr.v == '' ? '' : Farr.v }}
                </text>
              </view>
            </picker>

            <block v-else-if="Farr.subkind == 3"></block>

            <block v-else-if="Farr.subkind == 5">
              <view v-if="Farr.fieldname == 'photo_s'">
                <view
                    :data-idx="idx"
                    :data-nomod="Farr.nomod"
                    :data-value="Farr.i"
                    :style="'border-color: rgba(' + rgbcolor + ',.2);background-color: rgba(' + rgbcolor + ',.05);'"
                    class="icoadd"
                    @tap="photo_s_cutFn"
                >
                  <block v-if="Farr.i">
                    <image :src="Farr.i" class="photo_s" mode="widthFix" @tap.stop="datu(Farr.i)"></image>
                    <text :style="'--rgbcolor:' + rgbcolor" class="photo_sT">更换头像</text>
                  </block>
                  <block v-else>
                    <view :style="'color:rgba(' + rgbcolor + ',.6);'" class="i ico"></view>
                    <text :style="'color:rgba(' + rgbcolor + ',.6);'">上传头像</text>
                  </block>
                </view>
              </view>
              <picker
                  v-else-if="Farr.fieldname == 'birthday'"
                  :class="'dl' + (idx % 6 == 0 || form_basic.length == idx + 1 ? ' dl0' : '')"
                  :data-f="Farr.fieldname"
                  :data-idx="idx"
                  :end="Farr.end"
                  :headerText="'请选择' + Farr.title"
                  :range="UDATA_var[Farr.fieldname]"
                  :start="Farr.start"
                  :value="Farr.k"
                  mode="date"
                  rangeKey="v"
                  @change="birthdayFn"
              >
                <view class="dt">
                  {{ Farr.title }}
                  <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
                </view>
                <view class="dd">
                  <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')"
                        :style="Farr.nomod == 1 && Farr.v != '' ? 'color:#ccc' : ''">
                    {{ Farr.v == 0 || Farr.v == '' ? '' : Farr.v }}
                  </text>
                </view>
              </picker>
              <picker
                  v-else-if="Farr.fieldname == 'areaid'"
                  :class="'dl' + (idx % 6 == 0 || form_basic.length == idx + 1 ? ' dl0' : '')"
                  :data-f="Farr.fieldname"
                  :data-idx="idx"
                  :headerText="'请选择' + Farr.title"
                  :range="areaidARRDEF"
                  :value="areaidIdx"
                  mode="multiSelector"
                  rangeKey="v"
                  @change="areaidFn"
                  @columnchange="areaidChangeFn"
              >
                <view class="dt">
                  {{ Farr.title }}
                  <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
                </view>
                <view class="dd">
                  <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                    {{ Farr.v == 0 || Farr.v == '' ? '' : Farr.v }}
                  </text>
                </view>
              </picker>
              <picker
                  v-else-if="Farr.fieldname == 'area2id'"
                  :class="'dl' + (idx % 6 == 0 || form_basic.length == idx + 1 ? ' dl0' : '')"
                  :data-f="Farr.fieldname"
                  :data-idx="idx"
                  :headerText="'请选择' + Farr.title"
                  :range="area2idARRDEF"
                  :value="area2idIdx"
                  mode="multiSelector"
                  rangeKey="v"
                  @change="area2idFn"
                  @columnchange="area2idChangeFn"
              >
                <view class="dt">
                  {{ Farr.title }}
                  <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
                </view>
                <view class="dd">
                  <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                    {{ Farr.v == 0 || Farr.v == '' ? '' : Farr.v }}
                  </text>
                </view>
              </picker>
            </block>
          </block>
        </view>
        <view class="listbox">
          <view v-for="(Farr2, idx2) in form_contact" v-if="Farr2.fieldname != 'mob'" :key="idx2" class="dl">
            <view class="dt">
              {{ Farr2.title }}
              <text v-if="Farr2.ifmust == 1" class="reg_ifmust">*</text>
            </view>
            <view class="dd">
              <block v-if="Farr2.fieldname == 'weixin_pic'">
                <view
                    v-if="Farr2.v == ''"
                    :data-f="Farr2.fieldname"
                    :data-idx2="idx2"
                    :style="'color:rgba(' + rgbcolor + ',.6);border-color:rgba(' + rgbcolor + ',.2);background-color:rgba(' + rgbcolor + ',.05);'"
                    class="ico weixin_pic_ico"
                    @tap="weixin_picFn"
                >
                  
                </view>
                <image v-else :data-f="Farr2.fieldname" :data-idx2="idx2" :src="Farr2.v"
                       class="weixin_pic_image" mode="aspectFit" @tap="weixin_picFn"></image>
              </block>
              <input
                  v-else
                  :data-f="Farr2.fieldname"
                  :data-idx2="idx2"
                  :placeholder="'请输入' + Farr2.title"
                  :value="Farr2.v == 0 || Farr2.v == '' ? '' : Farr2.v"
                  maxlength="50"
                  type="text"
                  @blur="Ffn1_contact"
              />
            </view>
          </view>
        </view>
        <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="nextbtn">
          <button class="btn5" data-idx="1" @tap="btn5Fn">
            下一步
            <text>(1/3)</text>
          </button>
        </view>
      </block>
      <block v-if="currentTab == 1">
        <view class="listbox">
          <block v-for="(Farr, idx) in form_ext" :key="idx">
            <view v-if="Farr.subkind == 1"
                  :class="'dl' + ((idx % 6 == 0 && idx > 0) || form_ext.length == idx + 1 ? ' dl0' : '')">
              <view class="dt">
                {{ Farr.title }}
                <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
              </view>
              <view class="dd">
                <input
                    :data-f="Farr.fieldname"
                    :data-idx="idx"
                    :placeholder="'请输入' + Farr.title"
                    :value="Farr.v == 0 || Farr.v == '' ? '' : Farr.v"
                    confirmType="完成"
                    maxlength="50"
                    type="text"
                    @blur="Ffn1_ext"
                />
              </view>
            </view>

            <picker
                v-else-if="Farr.subkind == 2 || Farr.subkind == 4"
                :class="'dl' + ((idx % 6 == 0 && idx > 0) || form_ext.length == idx + 1 ? ' dl0' : '')"
                :data-f="Farr.fieldname"
                :data-idx="idx"
                :headerText="'请选择' + Farr.title"
                :range="UDATA_var[Farr.fieldname]"
                :value="Farr.k"
                rangeKey="v"
                @change="Ffn2_ext"
            >
              <view class="dt">
                {{ Farr.title }}
                <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
              </view>
              <view class="dd">
                <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                  {{ Farr.v == 0 || Farr.v == '' ? '' : Farr.v }}
                </text>
              </view>
            </picker>

            <view
                v-else-if="Farr.subkind == 3"
                :class="'dl' + ((idx % 6 == 0 && idx > 0) || form_ext.length == idx + 1 ? ' dl0' : '')"
                :data-f="Farr.fieldname"
                :data-i="Farr.i"
                :data-idx="idx"
                @tap="Ffn3_ext"
            >
              <view class="dt">
                {{ Farr.title }}
                <text v-if="Farr.ifmust == 1" class="reg_ifmust">*</text>
              </view>
              <view class="dd">
                <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                  {{ Farr.v == 0 || Farr.v == '' ? '' : Farr.v }}
                </text>
              </view>
            </view>
          </block>
        </view>
        <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="nextbtn">
          <button class="btn5" data-idx="2" @tap="btn5Fn">
            下一步
            <text>(2/3)</text>
          </button>
        </view>
      </block>
      <block v-if="currentTab == 2">
        <view class="listbox">
          <block v-for="(Farr, idx) in form_mate" :key="idx">
            <view v-if="Farr.subkind == 1" class="dl">
              <view class="dt">{{ Farr.title }}</view>
              <view class="dd">
                <input
                    :data-f="Farr.fieldname"
                    :data-idx="idx"
                    :placeholder="'请输入' + Farr.title"
                    :value="Farr.v == 0 || Farr.v == '' ? '' : Farr.v"
                    confirmType="完成"
                    maxlength="50"
                    type="text"
                    @blur="Ffn1_mate"
                />
              </view>
            </view>

            <picker
                v-else-if="Farr.subkind == 2"
                :data-f="Farr.fieldname"
                :data-idx="idx"
                :headerText="'请选择' + Farr.title"
                :range="UDATA_var[Farr.fieldname]"
                :value="Farr.k"
                class="dl"
                rangeKey="v"
                @change="Ffn2_mate"
            >
              <view class="dt">{{ Farr.title }}</view>
              <view class="dd">
                <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                  {{ Farr.v == 0 || Farr.v == '' ? '不限' : Farr.v }}
                </text>
              </view>
            </picker>

            <view v-else-if="Farr.subkind == 3" :data-f="Farr.fieldname" :data-i="Farr.i" :data-idx="idx" class="dl"
                  @tap="Ffn3_mate">
              <view class="dt">{{ Farr.title }}</view>
              <view class="dd">
                <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                  {{ Farr.v == 0 || Farr.v == '' ? '不限' : Farr.v }}
                </text>
              </view>
            </view>

            <picker
                v-else-if="Farr.subkind == 4"
                :data-f="Farr.fieldname"
                :data-idx="idx"
                :headerText="'请选择' + Farr.title"
                :range="Farr.rang_ARR"
                :value="Farr.rang_Idx"
                class="dl"
                mode="multiSelector"
                rangeKey="v"
                @change="Ffn4_mate"
                @columnchange="Ffn4_change_mate"
            >
              <view class="dt">{{ Farr.title }}</view>
              <view class="dd">
                <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                  {{ Farr.v == 0 || Farr.v == '' ? '不限' : Farr.v }}
                </text>
              </view>
            </picker>

            <block v-else-if="Farr.subkind == 5">
              <picker
                  v-if="Farr.fieldname == 'areaid'"
                  :data-f="Farr.fieldname"
                  :data-idx="idx"
                  :headerText="'请选择' + Farr.title"
                  :range="Farr.def"
                  :value="Farr.idx"
                  class="dl"
                  data-kind="job"
                  mode="multiSelector"
                  rangeKey="v"
                  @change="areaidFn_mate"
                  @columnchange="areaidChangeFn_mate"
              >
                <view class="dt">{{ Farr.title }}</view>
                <view class="dd">
                  <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                    {{ Farr.v == 0 || Farr.v == '' ? '不限' : Farr.v }}
                  </text>
                </view>
              </picker>
              <picker
                  v-else-if="Farr.fieldname == 'areaid2'"
                  :data-f="Farr.fieldname"
                  :data-idx="idx"
                  :headerText="'请选择' + Farr.title"
                  :range="Farr.def"
                  :value="Farr.idx"
                  class="dl"
                  data-kind="hj"
                  mode="multiSelector"
                  rangeKey="v"
                  @change="areaidFn_mate"
                  @columnchange="areaidChangeFn_mate"
              >
                <view class="dt">{{ Farr.title }}</view>
                <view class="dd">
                  <text :class="'ico span' + (Farr.v == 0 || Farr.v == '' ? '' : ' ed')">
                    {{ Farr.v == 0 || Farr.v == '' ? '不限' : Farr.v }}
                  </text>
                </view>
              </picker>
            </block>
          </block>
        </view>
        <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="nextbtn">
          <button class="btn5" data-idx="3" @tap="btn5Fn">
            保存并提交
            <text>(3/3)</text>
          </button>
        </view>
      </block>
    </view>
    <view class="blank"></view>
    <view v-if="div_sq" class="mask3 alpha0_100">
      <view class="div_box big_normal" style="--div_box_width: 70%; --div_box_height: 570rpx">
        <view :style="'border-color: rgba(' + rgbcolor + ',.2);'" class="m">
          <image mode="aspectFit" src="/static/res/img/photo_m.png"></image>
        </view>
        <view class="S22 B">授权获取微信昵称</view>
        <view class="C999">授权后，将自动获取微信昵称</view>
        <button
            :style="
                        'background:-webkit-linear-gradient(315deg,rgba(' +
                        rgbcolor +
                        ',.6) 0%,' +
                        color +
                        ' 100%);background-color: #fff;box-shadow:0 6rpx 16rpx rgb(' +
                        rgbcolor +
                        ',.4);margin-top:50rpx'
                    "
            class="btn5"
            @tap="getUserProfile"
        >
          <text>同意获取</text>
          <text :style="'color: ' + color + ';'">昵称</text>
        </button>
      </view>
    </view>
    <!-- parse <include src="../div_bottom_checkbox.wxml"></include> -->
    <block>
      <view v-if="if_div_bottom" :class="'mask1 ' + div_bottom_mask_class" @tap.stop.prevent="div_bottom_close_Fn">
        <view :class="'div_bottom ' + div_bottom_box_class" @tap.stop.prevent="div_bottom_blank_Fn">
          <view class="T">
            <text class="cancel" @tap.stop.prevent="div_bottom_close_Fn">取消</text>
            <text class="center">支持多项选择</text>
            <text :style="'color:' + (D.mbkind == 2 ? D.mbbgcolor : color)" class="save"
                  @tap.stop.prevent="div_bottom_save_Fn">确定
            </text>
          </view>
          <view class="C">
            <checkbox-group class="checkbox_li" @change="checkboxChangeFn">
              <label v-for="(item, index) in checkbox_arr" :key="index" class="a">
                <checkbox :checked="item.ed" :value="item.i"></checkbox>

                {{ item.v }}
              </label>
            </checkbox-group>
          </view>
        </view>
      </view>
    </block>
    <view v-if="div_login" class="mask3 alpha0_100">
      <view
          class="div_box big_normal"
          style="--div_box_width: 72%; --div_box_height: 600rpx; background: -webkit-linear-gradient(top, #fde9ee 1%, #fff 150%); background-color: #fff"
      >
        <view :style="'border-color:rgba(' + rgbcolor + ',.2);'" class="m">
          <image mode="aspectFit" src="/static/res/img/photo_m.png"></image>
        </view>
        <view class="S22 B">登录后获得更精准推荐</view>
        <view class="loginagree">
          <checkbox-group @change="ifagreeFn">
            <label style="margin-left: -10rpx">
              <checkbox :style="'--color:' + color + ';'" value="1"></checkbox>
              <text class="C666 vmiddle">阅读并同意</text>
            </label>
          </checkbox-group>
          <navigator :style="'color:' + color" class="vmiddle" hoverClass="none" url="/pagesA/about/law?kind=agreement">
            用户协议
          </navigator>
          <text class="C666 vmiddle">与</text>
          <navigator :style="'color:' + color + ';'" class="vmiddle" hoverClass="none"
                     url="/pagesA/about/law?kind=declara">隐私条款
          </navigator>
        </view>
        <button
            v-if="ifagree"
            :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
            class="btn5 W90_"
            openType="getPhoneNumber"
            @getphonenumber="getPhoneNumber"
        >
          <text>手机号快捷登录</text>
          <text :style="'color: ' + color + ';'">私密</text>
        </button>
        <button v-else :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
                class="btn5" @tap="ifagree_passFn">
          <text>手机号快捷登录</text>
          <text :style="'color: ' + color + ';'">私密</text>
        </button>
      </view>
    </view>
    <privacy-popup @agree="privacy_agree" @disagree="privacy_disagree"></privacy-popup>
  </view>
</template>
<script>
import privacyPopup from '../../components/privacyPopup/privacyPopup.vue';

var a = require('../../@babel/runtime/helpers/defineProperty');
var t = require('../../res/www.a9a.cn.js');
var app = getApp();
var i = uni.getStorageSync('COOK_U');
export default {
  components: {
    privacyPopup
  },
  data() {
    return {
      color: app.globalData._ZEAI.color,
      rgbcolor: app.globalData._ZEAI.rgbcolor,
      topbar: ['基本资料', '详细资料', '择偶要求'],
      currentTab: 0,
      div_sq: false,
      if_aboutus_box: false,
      if_aboutus_focus: false,
      UDATA_var: [],
      form_basic: [],
      form_ext: [],
      areaidARR: [],
      areaidARRDEF: [],
      areaidIdx: [],
      area2idARR: [],
      area2idARRDEF: [],
      area2idIdx: [],
      if_ext_box1: false,
      checkboxvalue: [],
      ifmate: false,
      div_login: false,
      arealeval: '',
      form_contact: '',
      form_mate: '',
      MB: '',
      if_div_bottom: false,
      div_bottom_mask_class: '',
      div_bottom_box_class: '',
      checkbox_F: '',
      checkbox_idx: '',
      checkbox_arr: '',
      ifagree: false,

      Farr: {
        subkind: 0,
        ifmust: 0,
        fieldname: '',
        v: '',
        title: '',
        nomod: 0,
        k: '',
        i: '',
        end: '',
        start: '',
        rang_ARR: '',
        rang_Idx: '',
        def: '',
        idx: ''
      },

      Farr2: {
        fieldname: '',
        ifmust: 0,
        v: '',
        title: ''
      },
      idx2: 0,
      D: {
        mbkind: 0,
        mbbgcolor: ''
      }
    };
  },
  onLoad: function (a) {
    uni.showLoading({
      title: '玩命加载中...',
      mask: true
    });
    var that = this;
    app.globalData.get_config('_ZEAI').then(function (a) {
      that.setData({
        color: app.globalData._ZEAI.color,
        rgbcolor: t.c16_rgb(app.globalData._ZEAI.color)
      });
    });
    app.globalData.get_navigationBarTopHeight(this);
    i = uni.getStorageSync('COOK_U');
    if (t.empty(i.openid)) {
      uni.reLaunch({
        url: '/pages/my/my'
      });
    } else {
      app.globalData.ajax({
        url: 'reg.php?submitok=U',
        data: {
          openid: i.openid
        },
        success: function (e) {
          if (1 == e.flag) {
            if (0 == e.SL_U.ifmob) {
              that.setData({
                div_login: true
              });
              return void uni.hideLoading();
            }
            that.setData({
              div_login: false
            });
            var i = 2 == a.currentTab ? 2 : 0;
            that._UDATA = e._UDATA
            that.setData({
              arealeval: e.arealeval,
              form_basic: e.form_basic,
              form_contact: e.form_contact,
              form_ext: e.form_ext,
              form_mate: e.form_mate,
              UDATA_var: e._UDATA,
              areaidARR: e.areaidARR,
              areaidARRDEF: e.areaidARR.ARRDEF,
              areaidIdx: e.areaidARR.Idx,
              area2idARR: e.area2idARR,
              area2idARRDEF: e.area2idARR.ARRDEF,
              area2idIdx: e.area2idARR.Idx,
              currentTab: i,
              MB: e.MB
            });
            var d = t.empty(e.SL_U.dataflag_title) ? '' : '【' + e.SL_U.dataflag_title + '】';
            uni.setNavigationBarTitle({
              title: '完善度' + e.SL_U.myinfobfb + '％' + d
            });
            uni.hideLoading();
          } else {
            'flag_1' == e.flag
                ? (uni.hideLoading(),
                    uni.showLoading({
                      title: '您已注销或被锁定',
                      mask: true
                    }))
                : uni.reLaunch({
                  url: '/pages/my/my'
                });
          }
        }
      });
    }
  },
  onReady: function () {
  },
  onShow: function () {
    var t = app.globalData.U.photo_s;
    var i = app.globalData.U.idx;
    if (t) {
      this.setData(a({}, 'form_basic[' + i + '].i', t));
    }
  },
  methods: {
    getPhoneNumber: function (a) {
      app.globalData.getPhoneNumber({
        e: a,
        url: 'reg',
        urlkind: 'reLaunch'
      });
    },

    back: function () {
      1 == this.pages.length
          ? uni.exitMiniProgram({
            success: function (a) {
            }
          })
          : uni.navigateBack();
    },

    topbarFn: function (a) {
      this.setData({
        currentTab: a.currentTarget.dataset.idx
      });
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 300
      });
    },

    btn5Fn: function (a) {
      var that = this;
      var d = a.currentTarget.dataset.idx;
      i = uni.getStorageSync('COOK_U');
      var o = this;
      t.empty(o.MB) ||
      app.globalData.openSetting(o.MB, function (a) {
        uni.pageScrollTo({
          scrollTop: 0,
          duration: 300
        });
      });
      3 == d
          ? app.globalData.ajax({
            url: 'reg.php',
            data: {
              submitok: 'reged_update',
              openid: i.openid
            },
            success: function (a) {
              1 == a.flag
                  ? uni.showModal({
                    content: a.msg,
                    confirmColor: that.color,
                    confirmText: '朕知道了',
                    showCancel: false,
                    success: function (a) {
                      1 == o.pages.length
                          ? uni.switchTab({
                            url: '/pages/my/my'
                          })
                          : uni.navigateBack({
                            delta: -1
                          });
                    }
                  })
                  : uni.showModal({
                    content: a.msg,
                    confirmColor: that.color,
                    confirmText: '朕知道了',
                    showCancel: false,
                    success: function (a) {
                      o.setData({
                        currentTab: 0
                      });
                    }
                  });
            }
          })
          : this.setData({
            currentTab: d
          });
    },

    getUserProfile: function () {
      var that = this;
      var r = uni.getStorageSync('COOK_U');
      t.empty(r.openid) ||
      uni.getUserProfile({
        desc: '用于完善会员资料',
        success: function (d) {
          uni.request({
            url: app.globalData.WWW + '/api/wxxcx/reg.php',
            data: {
              submitok: 'getUserProfile',
              openid: r.openid,
              unionid: r.unionid,
              nickname: d.userInfo.nickName,
              avatarUrl: d.userInfo.avatarUrl
            },
            success: function (e) {
              e = t.jsoneval(e.data);
              var r = t.get_F_idx('nickname', that.form_basic);
              1 == e.flag
                  ? (that.setData(
                      a(
                          {
                            div_sq: false
                          },
                          'form_basic[' + r + '].v',
                          e.U.nickname
                      )
                  ),
                      uni.setNavigationBarTitle({
                        title: '资料完善度 ' + e.U.myinfobfb + '％'
                      }))
                  : uni.showModal({
                    content: e.msg,
                    confirmColor: that.color,
                    confirmText: '朕知道了',
                    showCancel: false,
                    success: function (a) {
                    }
                  });
            }
          });
        }
      });
    },

    photo_s_cutFn: function (a) {
      var that = this;
      a.currentTarget.dataset.value;
      var t = a.currentTarget.dataset.idx;
      if (1 == a.currentTarget.dataset.nomod) {
        uni.showModal({
          content: '头像禁止修改，若需修改请联系客服',
          confirmColor: this.color,
          confirmText: '朕知道了',
          showCancel: false,
          success: function (a) {
          }
        });
        return false;
      }
      app.globalData.U.idx = t;

      uni.chooseImage({
        count: 1,
        sizeType: ['original', 'compressed'],
        sourceType: ['album', 'camera'],
        success: function (i) {
          const s = i.tempFilePaths[0]
          uni.navigateTo({
            url: `/pagesA/cropper/cropper?imgSrc=${s}`
          });
        }
      })
  },

  Ffn1_basic: function (t) {
    var that = this;
    var i = t.currentTarget.dataset.f;
    var r = t.detail.value;
    var d = t.currentTarget.dataset.idx;
    this.modupdate({
      F: i,
      V: r,
      success: function (t) {
        that.setData(a({}, 'form_basic[' + d + '].v', r));
      }
    });
  }
  ,

  Ffn1_contact: function (t) {
    var e = t.currentTarget.dataset.f;
    var i = t.detail.value;
    var r = t.currentTarget.dataset.idx2;
    this.setData(a({}, 'form_contact[' + r + '].v', i));
    this.modupdate({
      F: e,
      V: i
    });
  }
  ,

  Ffn1_ext: function (t) {
    var e = t.currentTarget.dataset.f;
    var i = t.detail.value;
    var r = t.currentTarget.dataset.idx;
    this.setData(a({}, 'form_ext[' + r + '].v', i));
    this.modupdate({
      F: e,
      V: i
    });
  }
  ,

  Ffn1_mate: function (t) {
    var e = t.currentTarget.dataset.f;
    var i = t.detail.value;
    var r = t.currentTarget.dataset.idx;
    this.setData(a({}, 'form_mate[' + r + '].v', i));
    this.modupdate_mate({
      F: e,
      V: i
    });
  }
  ,

  Ffn2_basic: function (t) {
    var that = this;
    console.log('_UDATA的值', that._UDATA)
    var i = t.detail.value;
    var r = t.currentTarget.dataset.f;
    var d = this._UDATA[r][i];
    var o = t.currentTarget.dataset.idx;
    this.modupdate({
      F: r,
      V: d.i,
      success: function (t) {
        var r;
        that.setData((a((r = {}), 'form_basic[' + o + '].k', i), a(r, 'form_basic[' + o + '].v', d.v), r));
      }
    });
  }
  ,

  Ffn2_ext: function (t) {
    var e;
    var i = t.detail.value;
    var r = t.currentTarget.dataset.f;
    var d = this._UDATA[r][i];
    var o = t.currentTarget.dataset.idx;
    this.setData((a((e = {}), 'form_ext[' + o + '].k', i), a(e, 'form_ext[' + o + '].v', d.v), e));
    this.modupdate({
      F: r,
      V: d.i
    });
  }
  ,

  Ffn2_mate: function (t) {
    var e;
    var i = t.detail.value;
    var r = t.currentTarget.dataset.f;
    var d = this._UDATA[r][i];
    var o = t.currentTarget.dataset.idx;
    this.setData((a((e = {}), 'form_mate[' + o + '].k', i), a(e, 'form_mate[' + o + '].v', d.v), e));
    this.modupdate_mate({
      F: r,
      V: d.i
    });
  }
  ,

  Ffn3_ext: function (a) {
    a.detail.value;
    var e = a.currentTarget.dataset.f;
    var i = a.currentTarget.dataset.i;
    var r = a.currentTarget.dataset.idx;
    var d = t.set_checked(i, this._UDATA[e]);
    this.setData({
      ifmate: false,
      if_div_bottom: true,
      div_bottom_mask_class: 'alpha0_100',
      div_bottom_box_class: 'div_upAnm1',
      checkbox_F: e,
      checkbox_idx: r,
      checkbox_arr: d
    });
  }
  ,

  Ffn3_mate: function (a) {
    a.detail.value;
    var e = a.currentTarget.dataset.f;
    var i = a.currentTarget.dataset.i;
    var r = a.currentTarget.dataset.idx;
    var d = t.set_checked(i, this._UDATA[e]);
    this.setData({
      ifmate: true,
      if_div_bottom: true,
      div_bottom_mask_class: 'alpha0_100',
      div_bottom_box_class: 'div_upAnm1',
      checkbox_F: e,
      checkbox_idx: r,
      checkbox_arr: d
    });
  }
  ,

  Ffn4_mate: function (e) {
    var i;
    var r = e.currentTarget.dataset.f;
    var d = e.detail.value;
    var o = e.currentTarget.dataset.idx;
    if (d[0] > d[1]) {
      uni.showToast({
        title: '必须左小右大哦',
        icon: 'none'
      });
      return false;
    }
    var s = this.form_mate[o].rang_ARR[0];
    var c = t.idx_iv(d, s);
    var n = c[0];
    var u = c[1];
    this.setData((a((i = {}), 'form_mate[' + o + '].rang_Idx', d), a(i, 'form_mate[' + o + '].v', u), i));
    this.modupdate_mate({
      F: r,
      V: n
    });
  }
  ,

  Ffn4_change_mate: function (a) {
  }
  ,

  checkboxChangeFn: function (a) {
    this.setData({
      checkboxvalue: a.detail.value
    });
  }
  ,

  div_bottom_save_Fn: function (i) {
    var r = this.checkbox_idx;
    var d = t.checkbox_div_list_get_listTitle(this.checkboxvalue, this.checkbox_arr);
    var o = this.checkboxvalue;
    if (o.length >= app.globalData.checkboxMaxNum) {
      uni.showToast({
        title: '最多选择 ' + app.globalData.checkboxMaxNum + ' 项',
        icon: 'none'
      });
      return false;
    }
    var s;
    var c;
    var n = t.set_checked(o, this.checkbox_arr);
    (this.div_bottom_close_Fn(), this.ifmate)
        ? (this.setData(
            (a(
                (s = {
                  checkbox_arr: n
                }),
                'form_mate[' + r + '].i',
                o.join(',')
            ),
                a(s, 'form_mate[' + r + '].v', d),
                s)
        ),
            this.modupdate_mate({
              F: this.checkbox_F,
              V: o.join(',')
            }))
        : (this.setData(
            (a(
                (c = {
                  checkbox_arr: n
                }),
                'form_ext[' + r + '].i',
                o.join(',')
            ),
                a(c, 'form_ext[' + r + '].v', d),
                c)
        ),
            this.modupdate({
              F: this.checkbox_F,
              V: o.join(',')
            }));
  }
  ,

  div_bottom_close_Fn: function () {
    var that = this;
    this.setData({
      div_bottom_mask_class: 'alpha100_0',
      div_bottom_box_class: 'div_upAnm2'
    });
    setTimeout(function () {
      that.setData({
        if_div_bottom: false
      });
    }, 400);
  }
  ,

  div_bottom_blank_Fn: function () {
  }
  ,

  birthdayFn: function (t) {
    var that = this;
    var i = t.detail.value;
    var r = t.currentTarget.dataset.f;
    var d = t.currentTarget.dataset.idx;
    console.log('修改生日')
    this.modupdate({
      F: r,
      V: i,
      success: function (t) {
        that.setData(a({}, 'form_basic[' + d + '].v', i));
      }
    });
  }
  ,

  areaidFn: function (e) {
    var i = e.currentTarget.dataset.f;
    var r = e.detail.value;
    var d = e.currentTarget.dataset.idx;
    var o = t.areaGetTtitle(r, this.areaidARR);
    var s = o[0];
    var c = o[1];
    this.setData(a({}, 'form_basic[' + d + '].v', c));
    this.modupdate({
      F: i,
      V: s,
      areatitle: c
    });
  }
  ,

  areaidChangeFn: function (a) {
    var e;
    var i;
    var r;
    var d = parseInt(this.arealeval);
    var o = a.detail.column;
    var s = a.detail.value;
    var c =
        (a.currentTarget.dataset.idx,
            a.currentTarget.dataset.ifmate,
            {
              areaidARRDEF: this.areaidARRDEF,
              areaidIdx: this.areaidIdx
            });
    var n = this.areaidARR.ARR1;
    var u = this.areaidARR.ARR2;
    var f = this.areaidARR.ARR3;
    var l = this.areaidARR.ARR4;
    var x = n;
    var _ = [];
    var h = [];
    var m = [];
    switch (o) {
      case 0:
        switch (((e = n[s].i), d >= 2 && (i = (_ = t.areaNEW(e, u))[0].i), d >= 3 && (r = (h = t.areaNEW(i, f))[0].i), d >= 4 && (m = t.areaNEW(r, l)), d)) {
          case 1:
            c.areaidARRDEF = [x];
            c.areaidIdx = [s];
            break;
          case 2:
            c.areaidARRDEF = [x, _];
            c.areaidIdx = [s, 0];
            break;
          case 3:
            c.areaidARRDEF = [x, _, h];
            c.areaidIdx = [s, 0, 0];
            break;
          case 4:
            c.areaidARRDEF = [x, _, h, m];
            c.areaidIdx = [s, 0, 0, 0];
        }
        break;
      case 1:
        e = n[c.areaidIdx[0]].i;
        if (d >= 2) {
          i = (_ = t.areaNEW(e, u))[s].i;
        }
        if (d >= 3) {
          r = (h = t.areaNEW(i, f))[0].i;
        }
        if (d >= 4) {
          m = t.areaNEW(r, l);
        }
        if (d >= 3) {
          c.areaidARRDEF[2] = h;
        }
        if (d >= 4) {
          c.areaidARRDEF[3] = m;
        }
        if (d >= 2) {
          c.areaidIdx[1] = s;
        }
        if (d >= 3) {
          c.areaidIdx[2] = 0;
        }
        if (d >= 4) {
          c.areaidIdx[3] = 0;
        }
        break;
      case 2:
        e = x[c.areaidIdx[0]].i;
        if (d >= 2) {
          i = (_ = t.areaNEW(e, u))[c.areaidIdx[1]].i;
        }
        if (d >= 3) {
          r = (h = t.areaNEW(i, f))[s].i;
        }
        if (d >= 4) {
          m = t.areaNEW(r, l);
        }
        if (d >= 4) {
          c.areaidARRDEF[3] = m;
        }
        if (d >= 3) {
          c.areaidIdx[2] = s;
        }
        if (d >= 4) {
          c.areaidIdx[3] = 0;
        }
        break;
      case 3:
        if (d >= 4) {
          c.areaidIdx[3] = s;
        }
    }
    this.setData(c);
  }
  ,

  areaidFn_mate: function (e) {
    for (var i = e.currentTarget.dataset.kind, r = e.currentTarget.dataset.f, d = e.detail.value, o = e.currentTarget.dataset.idx, s = [], c = 0; c < d.length; c++) {
      if (d[c] > 0) {
        s.push(d[c] - 1);
      }
    }
    d = s;
    if ('hj' == i) {
      var n = t.areaGetTtitle(d, this.area2idARR);
    } else {
      n = t.areaGetTtitle(d, this.areaidARR);
    }
    var u = n[0];
    var f = n[1];
    this.setData(a({}, 'form_mate[' + o + '].v', f));
    'hj' == i
        ? this.modupdate_mate({
          F: r,
          V: u,
          areatitle2: f
        })
        : this.modupdate_mate({
          F: r,
          V: u,
          areatitle: f
        });
  }
  ,

  areaidChangeFn_mate: function (e) {
    var i;
    var r = e.currentTarget.dataset.kind;
    var d = 'hj' == r ? 4 : parseInt(this.arealeval);
    var o = e.detail.column;
    var s = e.detail.value;
    var c = e.currentTarget.dataset.idx;
    var n = {
      def: this.form_mate[c].def,
      idx: this.form_mate[c].idx
    };
    if ('hj' == r) {
      var u = this.area2idARR.ARR1;
      var f = this.area2idARR.ARR2;
      var l = this.area2idARR.ARR3;
      var x = this.area2idARR.ARR4;
    } else {
      u = this.areaidARR.ARR1;
      f = this.areaidARR.ARR2;
      l = this.areaidARR.ARR3;
      x = this.areaidARR.ARR4;
    }
    var _;
    var h;
    var m;
    var g = [
      {
        i: '0',
        v: '不限',
        f: '0'
      }
    ];
    var R = u;
    var b = [];
    var v = [];
    var p = [];
    switch (((R = g.concat(R)), o)) {
      case 0:
        if (0 == s) {
          switch (((n.def[0] = R), d >= 2 && (n.def[1] = g), d >= 3 && (n.def[2] = g), d >= 4 && (n.def[3] = g), d)) {
            case 1:
              n.idx = [0];
              break;
            case 2:
              n.idx = [0, 0];
              break;
            case 3:
              n.idx = [0, 0, 0];
              break;
            case 4:
              n.idx = [0, 0, 0, 0];
          }
        } else {
          switch (((_ = u[s - 1].i), d)) {
            case 1:
              n.def = [R];
              n.idx = [s];
              break;
            case 2:
              b = g.concat(t.areaNEW(_, f));
              n.def = [R, b];
              n.idx = [s, 0];
              break;
            case 3:
              b = g.concat(t.areaNEW(_, f));
              n.def = [R, b, g];
              n.idx = [s, 0, 0];
              break;
            case 4:
              b = g.concat(t.areaNEW(_, f));
              n.def = [R, b, g, g];
              n.idx = [s, 0, 0, 0];
          }
        }
        break;
      case 1:
        if (0 == s) {
          if (d >= 3) {
            n.def[2] = g;
          }
          if (d >= 4) {
            n.def[3] = g;
          }
          if (d >= 2) {
            n.idx[1] = s;
          }
          if (d >= 3) {
            n.idx[2] = 0;
          }
          if (d >= 4) {
            n.idx[3] = 0;
          }
        } else {
          switch (d) {
            case 2:
              n.idx[1] = s;
              break;
            case 3:
              _ = u[n.idx[0] - 1].i;
              h = (b = g.concat(t.areaNEW(_, f)))[s].i;
              v = g.concat(t.areaNEW(h, l));
              n.def[2] = v;
              n.idx[1] = s;
              n.idx[2] = 0;
              break;
            case 4:
              _ = u[n.idx[0] - 1].i;
              h = (b = g.concat(t.areaNEW(_, f)))[s].i;
              v = g.concat(t.areaNEW(h, l));
              n.def[2] = v;
              n.def[3] = g;
              n.idx[1] = s;
              n.idx[2] = 0;
              n.idx[3] = 0;
          }
        }
        break;
      case 2:
        if (0 == s) {
          if (d >= 4) {
            n.def[3] = g;
          }
          if (d >= 3) {
            n.idx[2] = s;
          }
          if (d >= 4) {
            n.idx[3] = 0;
          }
        } else {
          switch (d) {
            case 3:
              n.idx[2] = s;
              break;
            case 4:
              _ = u[n.idx[0] - 1].i;
              h = (b = g.concat(t.areaNEW(_, f)))[n.idx[1]].i;
              m = (v = g.concat(t.areaNEW(h, l)))[s].i;
              p = g.concat(t.areaNEW(m, x));
              n.def[3] = p;
              n.idx[2] = s;
              n.idx[3] = 0;
          }
        }
        break;
      case 3:
        if (d >= 4) {
          n.idx[3] = s;
        }
    }
    this.setData((a((i = {}), 'form_mate[' + c + '].def', n.def), a(i, 'form_mate[' + c + '].idx', n.idx), i));
  }
  ,

  area2idFn: function (e) {
    var i = e.currentTarget.dataset.f;
    var r = e.detail.value;
    var d = e.currentTarget.dataset.idx;
    var o = t.areaGetTtitle(r, this.area2idARR);
    var s = o[0];
    var c = o[1];
    this.setData(a({}, 'form_basic[' + d + '].v', c));
    this.modupdate({
      F: i,
      V: s,
      area2title: c
    });
  }
  ,

  area2idChangeFn: function (a) {
    var e;
    var i;
    var r;
    var d = a.detail.column;
    var o = a.detail.value;
    var s =
        (a.currentTarget.dataset.idx,
            {
              area2idARRDEF: this.area2idARRDEF,
              area2idIdx: this.area2idIdx
            });
    var c = this.area2idARR.ARR1;
    var n = this.area2idARR.ARR2;
    var u = this.area2idARR.ARR3;
    var f = this.area2idARR.ARR4;
    var l = c;
    var x = [];
    var _ = [];
    var h = [];
    switch (d) {
      case 0:
        e = c[o].i;
        i = (x = t.areaNEW(e, n))[0].i;
        r = (_ = t.areaNEW(i, u))[0].i;
        h = t.areaNEW(r, f);
        s.area2idARRDEF = [l, x, _, h];
        s.area2idIdx = [o, 0, 0, 0];
        break;
      case 1:
        e = c[s.area2idIdx[0]].i;
        i = (x = t.areaNEW(e, n))[o].i;
        r = (_ = t.areaNEW(i, u))[0].i;
        h = t.areaNEW(r, f);
        s.area2idARRDEF[2] = _;
        s.area2idARRDEF[3] = h;
        s.area2idIdx[1] = o;
        s.area2idIdx[2] = 0;
        s.area2idIdx[3] = 0;
        break;
      case 2:
        e = l[s.area2idIdx[0]].i;
        i = (x = t.areaNEW(e, n))[s.area2idIdx[1]].i;
        r = (_ = t.areaNEW(i, u))[o].i;
        h = t.areaNEW(r, f);
        s.area2idARRDEF[3] = h;
        s.area2idIdx[2] = o;
        s.area2idIdx[3] = 0;
        break;
      case 3:
        s.area2idIdx[3] = o;
    }
    this.setData(s);
  }
  ,

  aboutusFn: function (a) {
    var that = this;
    that.setData({
      if_aboutus_box: true
    });
    setTimeout(function () {
      that.setData({
        if_aboutus_focus: true
      });
    }, 500);
  }
  ,

  aboutusMaskFn: function () {
    this.setData({
      if_aboutus_box: false,
      if_aboutus_focus: false
    });
  }
  ,

  aboutus_submitFn: function (t) {
    var e = t.currentTarget.dataset.f;
    var i = t.currentTarget.dataset.idx;
    var r = t.detail.value.aboutus;
    this.setData(
        a(
            {
              if_aboutus_box: false,
              if_aboutus_focus: false
            },
            'form_basic[' + i + '].v',
            r
        )
    );
    this.modupdate({
      F: e,
      V: r
    });
  }
  ,

  weixin_picFn: function (i) {
    var that = this;
    var d = (i.currentTarget.dataset.f, i.currentTarget.dataset.idx2);
    var o = uni.getStorageSync('COOK_U');
    uni.chooseImage({
      success: function (i) {
        var s = i.tempFilePaths;
        uni.uploadFile({
          url: app.globalData.WWW + '/api/wxxcx/reg.php',
          filePath: s[0],
          name: 'pic',
          formData: {
            submitok: 'weixin_pic_update',
            openid: o.openid
          },
          success: function (e) {
            '1' == (e = t.jsoneval(e.data)).flag
                ? (uni.setNavigationBarTitle({
                  title: '资料完善度 ' + e.myinfobfb + '％'
                }),
                    that.setData(a({}, 'form_contact[' + d + '].v', e.weixin_pic)))
                : uni.showModal({
                  content: e.msg,
                  confirmColor: that.color,
                  confirmText: '朕知道了',
                  showCancel: false,
                  success: function (a) {
                  }
                });
          }
        });
      }
    });
  }
  ,

  modupdate: function (a) {
    var that = this;
    var r = uni.getStorageSync('COOK_U');
    uni.request({
      url: app.globalData.WWW + '/api/wxxcx/reg.php',
      data: {
        submitok: 'modupdate',
        openid: r.openid,
        F: a.F,
        V: a.V,
        areatitle: a.areatitle,
        area2title: a.area2title
      },
      success: function (e) {
        1 == (e = t.jsoneval(e.data)).flag
            ? (uni.setNavigationBarTitle({
              title: '资料完善度 ' + e.myinfobfb + '％'
            }),
            'function' == typeof a.success && a.success(e))
            : uni.showModal({
              content: e.msg,
              confirmColor: that.color,
              confirmText: '朕知道了',
              showCancel: false,
              success: function (a) {
              }
            });
      }
    });
  }
  ,

  modupdate_mate: function (a) {
    var that = this;
    var r = uni.getStorageSync('COOK_U');
    uni.request({
      url: app.globalData.WWW + '/api/wxxcx/reg.php',
      data: {
        submitok: 'modupdate_mate',
        openid: r.openid,
        F: a.F,
        V: a.V,
        areatitle: a.areatitle,
        areatitle2: a.areatitle2
      },
      success: function (a) {
        '1' == (a = t.jsoneval(a.data)).flag
            ? uni.setNavigationBarTitle({
              title: '资料完善度 ' + a.myinfobfb + '％'
            })
            : uni.showModal({
              content: a.msg,
              confirmColor: that.color,
              confirmText: '朕知道了',
              showCancel: false,
              success: function (a) {
              }
            });
      }
    });
  }
  ,

  ifagreeFn: function (a) {
    1 == a.detail.value
        ? this.setData({
          ifagree: true
        })
        : this.setData({
          ifagree: false
        });
  }
  ,

  ifagree_passFn: function () {
    uni.showToast({
      title: '请先点击同意《用户协议》和《隐私条款》',
      icon: 'none',
      mask: true,
      duration: 3000
    });
  }
  ,

  privacy_agree: function (a) {
    console.log('agree');
  }
  ,

  privacy_disagree: function (a) {
    console.log('disagree');
    uni.exitMiniProgram();
  },
    // 预览图片
    datu(img) {
      uni.previewImage({
        current: img,
        urls: [img]
      });
    },
  exit() {
    console.log('占位：函数 exit 未声明');
  }
}
}
;
</script>
<style>
@import 'reg.css';
</style>
